<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <!-- <script src="./剑指 Offer 05. 替换空格.js"></script> -->
    <title>Document</title>
  </head>
  <body>
    <script>
<<<<<<< HEAD
      var findRepeatNumber = function (nums) {
        let len = nums.length;
        for (let i = 0; i < len; ) {
          if (nums[i] == i) {
            i++;
            continue;
=======
      var missingNumber = function (nums) {
        let len = nums.length;
        let left = 0;
        let right = len - 1;
        while (left <= right) {
          let middle = left + Math.floor((right - left) / 2);
          if (nums[middle] == middle) {
            left = middle + 1;
          } else {
            right = middle - 1;
>>>>>>> d1ed2b3ef50c767f0b5ea66f44222d12a71136a2
          }
          if (nums[nums[i]] == nums[i]) return nums[i];
          nums[i] = nums[i] + nums[nums[i]];
          nums[nums[i]] = nums[i] - nums[nums[i]];
          nums[i] = nums[i] - nums[nums[i]];
        }
<<<<<<< HEAD
        return -1;
      };
      console.log(findRepeatNumber([2, 3, 1, 0, 2, 5, 3]));
=======
        return left;
      };
      missingNumber([0, 1, 2, 3]);
>>>>>>> d1ed2b3ef50c767f0b5ea66f44222d12a71136a2
    </script>
  </body>
</html>
